﻿using System;
using System.Collections.Generic;
using Dos.ORM;

public partial class webmx_program_product_Set : PageBase
{
    public temple_rally ra;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["id"] != null && Request["id"] != string.Empty)
        {
            int id = int.Parse(Request["id"]);
            ra = DB.Context.From<temple_rally>().Select(s => new { s.ID, s.Name, s.SortID, s.StartTime, s.EndTime, s.Year }).Where(w => w.ID == id).First();
            if (IsPostBack)
            {
                ra.Name = Request["txtName"];
                ra.Year = int.Parse(Request["txtYear"]);
                ra.StartTime = DateTime.Parse(Request["txtStart"]);
                ra.EndTime = DateTime.Parse(Request["txtEnd"]);
                ra.SortID = int.Parse(Request["txtSort"]);
                int res = DB.Context.Update(ra);
                if (res > 0)
                    AlertRedirect("更新成功!", "list.aspx");
                else
                    Alert("更新失败，请重试!");
            }
        }
        else
            Response.Redirect("list.aspx");
    }
}